package com.ting.etp.loader.launcher;

import com.ting.etp.loader.launcher.EtpAbstractLauncher;

/**
 * 启动上下文
 *
 * @author starBlues
 * @since 3.0.0
 * @version 3.0.2
 */
public class EtpLauncherContext {

    private static volatile ClassLoader mainClassLoader = null;

    /**
     * 获取主程序的ClassLoader
     * @return 主程序ClassLoader
     */
    public static ClassLoader getMainClassLoader(){
        return mainClassLoader;
    }

    /**
     * 设置主程序的ClassLoader
     * @param classLoader 主程序ClassLoader
     */
    static void setMainClassLoader(ClassLoader classLoader){
        if(mainClassLoader == null){
            synchronized (EtpAbstractLauncher.class){
                if(mainClassLoader == null){
                    mainClassLoader = classLoader;
                }
            }
        }
    }


}
